//
//  YBReceiveViewController+LayoutConstraints.m
//  Nectar
//
//  Created by famer on 2023/11/8.
//  Copyright © 2023 asance. All rights reserved.
//

#import "YBReceiveViewController+LayoutConstraints.h"
#import "YBNavigationBar.h"

@implementation YBReceiveViewController (LayoutConstraints)

- (void)setLayoutConstraints{
    CGFloat width = self.view.size.width;
    CGFloat height = self.view.size.height;
    CGFloat leftMargin = 12;
    
    self.navigationBar.frame = CGRectMake(0,  [UIView statusBarHeight], width, 64);

    self.contentView.frame = CGRectMake(leftMargin, self.navigationBar.bottom + 16, width-leftMargin*2, 0);
    
    CGSize supportLabelSize = [self.supportLabel textBoundingSizeWithMaxSize:CGSizeMake(self.contentView.width, 500)];
    self.supportLabel.frame = CGRectMake(0, 36, self.contentView.width, supportLabelSize.height);
    self.qrCodeImageView.frame = CGRectMake(0, self.supportLabel.bottom+26, 200, 200);
    self.qrCodeImageView.contentMode = UIViewContentModeScaleAspectFit;
    self.qrCodeImageView.centerX = self.contentView.width*0.5;
    
    CGSize walletAddressLabelSize = [self.walletAddressLabel textBoundingSizeWithMaxSize:CGSizeMake(self.contentView.width, 500)];
    self.walletAddressLabel.frame = CGRectMake(0, self.qrCodeImageView.bottom+66, self.contentView.width, walletAddressLabelSize.height);
    self.walletAddressValueLabel.frame = CGRectMake(0, self.walletAddressLabel.bottom+10, self.contentView.width, walletAddressLabelSize.height);

    self.bottomContentView.frame = CGRectMake(0, self.walletAddressValueLabel.bottom+26, self.contentView.width, 60);
    
    self.shareContentView.frame = CGRectMake(0, 0, self.bottomContentView.width*0.5, self.bottomContentView.height);
    
    self.shareImageView.frame = CGRectMake(0, 0, 22, 22);
    self.shareImageView.centerY = self.shareContentView.height*0.5;
    
    CGSize shareLabelSize = [self.shareLabel textBoundingSizeWithMaxSize:CGSizeMake(400, 500)];
    self.shareLabel.frame = CGRectMake(self.shareImageView.right+16, 0, shareLabelSize.width, shareLabelSize.height);
    self.shareLabel.centerY = self.shareContentView.height*0.5;
    
    self.shareContentView.width = self.shareLabel.right;
    self.shareContentView.centerX = self.bottomContentView.width*0.25;

    self.copyContentView.frame = CGRectMake(0, 0, self.bottomContentView.width*0.5, self.bottomContentView.height);

    self.copyImageView.frame = CGRectMake(0, 0, 22, 22);
    self.copyImageView.centerY = self.copyContentView.height*0.5;
    
    CGSize copyLabelSize = [self.copyLabel textBoundingSizeWithMaxSize:CGSizeMake(400, 500)];
    self.copyLabel.frame = CGRectMake(self.copyImageView.right+16, 0, copyLabelSize.width, copyLabelSize.height);
    self.copyLabel.centerY = self.copyContentView.height*0.5;
    
    self.copyContentView.width = self.copyLabel.right;
    self.copyContentView.centerX = self.bottomContentView.width*0.75;

    self.contentView.height = self.bottomContentView.bottom;
}

@end
